import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('LayerManager')
export class LayerManager extends Component {
    @property(Node)
    public gameLayer: Node = null

    @property(Node)
    public uiLayer: Node = null

    @property(Node)
    public gameOverLayer: Node = null

    @property(Node)
    public gameStartLayer: Node = null

    onEnable() {
        this.gameStart()
    }

    public gameOver() {
        this.gameLayer.active = false
        this.uiLayer.active = false
        this.gameOverLayer.active = true
    }

    public transition() {
        this.gameLayer.active = true
        this.uiLayer.active = true
        this.gameStartLayer.active = false
    }

    public gameStart() {
        this.gameLayer.active = false
        this.uiLayer.active = false
        this.gameStartLayer.active = true
    }

    public nextLevel() {
        this.gameStart()
    }
}


